/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bash.carrep.ui.datasource;

import com.bash.carrep.dao.enties.Categoriepm;
import com.bash.carrep.dao.general.CRUD;
import com.vaadin.data.util.BeanItemContainer;
import java.io.Serializable;
import java.util.List;

/**
 *
 * @author p.bashizi
 */
public class CategPMContainer extends  BeanItemContainer<Categoriepm> implements Serializable{
    
    
    public CategPMContainer() throws IllegalArgumentException {
        super(Categoriepm.class);
    }
    public static final Object[] NATURAL_COL_ORDER = new Object[]{"idCategoriePM","description","tauxExoneration"};
    public static final String[] COL_HEADERS_FR = new String[]{"Code","Description","Taux Exoneration"};
    static CRUD crud = CRUD.getInstance();
    // static String query = "Select c.idcreditLevel , c.description  from CreditLevel c ";

    public static CategPMContainer getData() {

        CategPMContainer c = null;

        try {
            crud.start();
            c = new CategPMContainer();
            List<Categoriepm> list = crud.getAll(Categoriepm.class);

            //  List<CreditLevel> list = crud.getList(query);
            c.addAll(list);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            crud.stop();
        }

        return c;
    }
}

